﻿FlyTalk.views.SearchAskView = Ext.extend(Ext.form.FormPanel, {
	title: 'Ask',

        
    initComponent: function () {
		// back button on toolbar
		// this.backButton = new Ext.Button({
				// text: 'Back',
				// ui: 'back',
				// handler: this.backButtonTap,
				// scope: this
		// });
		
		// this.searchButton = new Ext.Button({
            // text: 'Ask',
            // ui: 'action',
            // handler: this.searchButtonTap,
            // scope: this
        // });
                
		//top tool bar
		// this.searchToolbar = new Ext.Toolbar({
				// title: 'Ask',
				
				// items:[
						// this.backButton,
						// { xtype: 'spacer' },
						// this.searchButton,
				// ]
				
		// });

        // this.dockedItems = [this.searchToolbar];

        FlyTalk.views.SearchAskView.superclass.initComponent.call(this);
    },  

    backButtonTap: function () {
                this.reset();
        Ext.dispatch({
            controller: FlyTalk.controllers.ftController,
            action: 'toTweetDeck1'
        });
    },
        
	searchButtonTap: function () {/*
                var searchField = Ext.getCmp('searchfield').getValue();
                var scopeSelect = Ext.getCmp("scopeselect").getValue();
                this.reset();
        Ext.dispatch({
            controller: FlyTalk.controllers.ftController,
          //  action: 'getRecentFlightPosts',
                        action: 'toTweetDeck1',
                        keyword: searchField,
                        scope: scopeSelect,
                        next: Flytalk.views.SearchResultsView,
                        method: 'getRecentFlightPosts',
                        list: Flytalk.views.SearchResultsView.tweetList,
        });*/
                this.reset();
        Ext.dispatch({
            controller: FlyTalk.controllers.dbController,
            action: 'getMixedPosts'
        });
    },
        
        scroll: false,
        
    items: [
        { // serach in
        xtype: 'textfield',
        name: 'search',
                id: 'searchfield',
        label: 'Search',
        required: true
        },
        { // search from (scope)
                 xtype: 'selectfield',
                 name: 'scope',
                 id: 'scopeselect',
                 label: 'Search in comments from: ',
                 labelWidth: 300,
                 labelAlign: 'top',
                 style: 'margin-top: 20px',
         options: [
                {text: 'my flight',  value: '@flight'},
                {text: 'my airline', value: '@airline'},
                {text: 'my terminal',  value: '@terminal'},
                        {text: 'all airport',  value: '@airport'}
                ]
        },
        ]
});
